import {
  reqCategoryList,
  reqBannerList,
  reqFloorList
} from '../../api'
const state = {
  categoryList: [],
  bannerList: [],
  floorList: []
}
const mutations = {
  CRTEGORYLIST(state, categoryList) {
    state.categoryList = categoryList
  },
  BNANERLIST(state, bannerList) {
    state.bannerList = bannerList
  },
  FLOORLIST(state, floorList) {
    state.floorList = floorList
  }
}
const actions = {
  //三级菜单
  async getCategoryList({
    commit
  }) {
    let result = await reqCategoryList()
    if (result.code == 200) {
      commit('CRTEGORYLIST', result.data)
    }
  },
  //轮播图
  async getBannerList({
    commit
  }) {
    let result = await reqBannerList()
    if (result.code == 200) {
      commit('BNANERLIST', result.data)
    }
  },
  //floor
  async getFloorList({
    commit
  }) {
    let result = await reqFloorList()

    if (result.code == 200) {
      commit('FLOORLIST', result.data)
    }
  }
}
const getters = {}
export default ({
  state,
  mutations,
  actions,
  getters
})